package com.myblog.services;

import com.myblog.Utils.SecurityUtils;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("ps")
public class PermissionService {

    public  boolean hasPermission(String permission){
        //如果是超级管理员直接返回true
        if(SecurityUtils.isAdmin()){
            return true;
        }
        //否则查询当前用户的权限并与permission对比
        List<String> permissionList=SecurityUtils.getPermission();
        return permissionList.contains(permission);
    }



}
